package day09API.Exception;

/**
 * @author DBX
 * @effect 常见面试题 finally要最后执行，覆盖前面的返回值
 * @date 2021/8/30 0030 - 19:04
 */
public class FinallyDemo3 {
    public static void main(String[] args) {
        System.out.println(fun("0")+" "+fun(null)+" "+fun(""));
    }
    public static int fun(String s){
        try {
            return s.charAt(0) - '0';
        } catch (NullPointerException e) {
            return 1;
        }catch (Exception e){
            return 2;
        }finally {
            return 3;
        }
    }
}
